package com.example.administrator.daydayappmarket.recommend.moduls;

import org.json.JSONException;
import org.json.JSONObject;

import java.text.DecimalFormat;

/**
 * Created by Administrator on 2016/12/26.
 */

public class RecommendApps {
    private String id;
    private String package_name;
    private String support_system;
    private String package_size;
    private String download_url;
    private String icon_url;
    private String name;
    private String download_count;
    private String apps_type;
    private String reviews;

    public String getApps_type() {
        return apps_type;
    }

    public void setApps_type(String apps_type) {
        this.apps_type = apps_type;
    }

    public String getReviews() {
        return reviews;
    }

    public void setReviews(String reviews) {
        this.reviews = reviews;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPackage_name() {
        return package_name;
    }

    public void setPackage_name(String package_name) {
        this.package_name = package_name;
    }

    public String getSupport_system() {
        return support_system;
    }

    public void setSupport_system(String support_system) {
        this.support_system = support_system;
    }

    public String getPackage_size() {
        return package_size;
    }

    public void setPackage_size(String package_size) {
        this.package_size = package_size;
    }

    public String getDownload_url() {
        return download_url;
    }

    public void setDownload_url(String download_url) {
        this.download_url = download_url;
    }

    public String getIcon_url() {
        return icon_url;
    }

    public void setIcon_url(String icon_url) {
        this.icon_url = icon_url;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDownload_count() {
        return download_count;
    }

    public void setDownload_count(String download_count) {
        this.download_count = download_count;
    }

    public void JsonParse(JSONObject jsonObject) {

        try {
            id = jsonObject.getString("id");
            apps_type = jsonObject.getString("apps_type");
            package_name = jsonObject.getString("package_name");
            support_system = jsonObject.getString("support_system");
            double package_size1 = jsonObject.getDouble("package_size");
            DecimalFormat df = new DecimalFormat("#.##");
            package_size = df.format(package_size1 / 1024 / 1024);
            download_url = jsonObject.getString("download_url");
            icon_url = jsonObject.getString("icon_url");
            name = jsonObject.getString("name");
            double download_count1 = jsonObject.getDouble("download_count");
            download_count = df.format(download_count1/10000);
            reviews = jsonObject.getString("reviews");
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}
